package com.pitaya.framework.web;

import com.pitaya.framework.common.Global;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class StartupListener implements ServletContextListener {
	public void contextDestroyed(ServletContextEvent contextEvent) {
	}

	public void contextInitialized(ServletContextEvent event) {
		init(event);
	}

	private void init(ServletContextEvent event) {
		ServletContext context = event.getServletContext();
		Global.ctx = context.getContextPath();
		context.setAttribute("ctx", Global.ctx);
	}
}
